package cn.slipi.provider.biz;

import cn.hutool.core.lang.UUID;
import cn.slipi.service.entity.TOrder;
import cn.slipi.service.service.TOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

@Component
public class OrderBiz {

    @Autowired
    private TOrderService orderService;

    public String createOrder() {
        String orderNo = UUID.randomUUID().toString();
        TOrder order = new TOrder();
        order.setOrderNo(orderNo);
        order.setAmount(new BigDecimal(200));
        order.setState(0);
        this.orderService.getBaseMapper().insert(order);
        return orderNo;
    }
}
